package xupt.com.bolg.zhifubao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import xupt.com.bolg.entity.User;
import xupt.com.bolg.service.impl.RewardServiceImpl;
import xupt.com.bolg.service.impl.UserServiceImpl;

import javax.servlet.http.HttpServletRequest;

@Controller
public class PayOkController {
    @Autowired
    UserServiceImpl userService;
    @Autowired
    RewardServiceImpl rewardService;
    @ResponseBody
    @GetMapping("/returnUrl")
    public String showSuccess(HttpServletRequest request){
        String  name = (String) request.getSession().getAttribute("name");
        User byName = userService.findByName(name);
        rewardService.adddodo(byName.getId(),10000);
        request.setAttribute("msg","充值成功");
        return "充值成功！！！";
    }
}
